package com.glodon.paas.account.dao.mysql;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import com.glodon.paas.account.dao.ResourceDao;
import com.glodon.paas.account.dao.domain.ResourceEntity;
import com.glodon.paas.account.dao.mapper.ResourceEntityMapper;

public class ResourceDaoMysqlImpl implements ResourceDao {
	@Autowired
	private ResourceEntityMapper resourceEntityMapper;
	
	@Override
	public String insert(ResourceEntity entity) {
		resourceEntityMapper.insertSelective(entity);
		return entity.getId();
	}

	@Override
	public ResourceEntity get(String id) {
		return resourceEntityMapper.selectByPrimaryKey(id);
	}

	@Override
	public int delete(String id) {
		return resourceEntityMapper.deleteByPrimaryKey(id);
	}
	
	@Override
	public List<ResourceEntity> findAll() {				
		return resourceEntityMapper.selectAll();
	}
}
